package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_FItenrDetDS {
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;
	
	
	public ASM_FItenrDetDS(Context context) {
		this.context = context;
		dbHelper  = new ASM_DB(context);
		
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	
	public int Create(ASM_FItenrDet det) 
	{
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		
		ContentValues values = new ContentValues();
		
		values.put(ASM_DB.asmFItenrdet_RefNo, det.getAsmFItenrdet_RefNo());
		values.put(ASM_DB.asmFItenrdet_TxnDate, det.getAsmFItenrdet_TxnDate());
		values.put(ASM_DB.asmFItenrdet_RDTarget, det.getAsmFItenrdet_RDTarget());
		values.put(ASM_DB.asmFItenrdet_RouteCode, det.getAsmFItenrdet_RouteCode());
	


		
		count = (int) dB.insert(ASM_DB.ASM_FITENRDET, null, values);

		dB.close();
		return count;
		
	}
}
